package com.xxx.greneric;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @version v1.0
 * @Description
 * @Author admin
 * @date 2021/7/21  13:51
 * @Copyright
 */
public class GenericDome03 {
    public static void main(String[] args) {
        ArrayList<String> strings = new ArrayList<>();
        strings.add("a");
        strings.add("b");
        it(strings);



        ArrayList<Integer> integers = new ArrayList<>();
        integers.add(1);
        integers.add(2);
        it(integers);
    }

//通配符
    public static void it(ArrayList<?> list){
        Iterator<?> iterator = list.iterator();
        while (iterator.hasNext()){
            System.out.println(iterator.next());
        }

    }

}
